import { createRouter, createWebHistory } from 'vue-router'
import login from "@/views/Login/index.vue"
import layout from "@/views/Layout/index.vue"
import category from '@/views/Category/index.vue'
import home from '@/views/Home/index.vue'
import subCategory from "@/views/subCategory/index.vue"
import detail from "@/views/Detail/index.vue"
import cardlist from '@/views/Layout/components/LayoutCardList.vue'
import checkout from "@/views/CheckOut/index.vue"
import pay from "@/views/Pay/index.vue"
import Payback from "@/views/Pay/Payback.vue";
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: layout,
      children:[
        {
          path:'',
          name:'homedef',
          component:home
        },
        {
          path:'category/:id',
          component:category
        },
        {
          path:'category/sub/:id',
          component:subCategory
        },
        {
          path:'detail/:id',
          component:detail
        },
        {
          path:'cardlist',
          component:cardlist
        },
        {
          path:'checkout',
          component:checkout
        },
        {
          path:'pay',
          component:pay
        },
        {
          path:'paycallback',
          component:Payback
        }
      ]
    },
    {
      path:'/login',
      name:'login',
      component:login
    }
  ],
  scrollBehavior(){
    return {top:0}
  }
})

export default router
